package com.phenix.mvp.base.helper;


import io.reactivex.FlowableTransformer;
import io.reactivex.ObservableTransformer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

/**
 * @author zhouphenix
 */
public class RxSchedulers {
    /**
     * io_main Flowable
     * @param <T> T
     * @return FlowableTransformer
     */
    public static <T>FlowableTransformer<T,T> io2Fmain(){
        return tFlowable -> tFlowable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * io_main Observable
     * @param <T> T
     * @return ObservableTransformer
     */
    public static <T>ObservableTransformer<T,T> io2Omain(){
        return tObservable -> tObservable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }
}
